Skip to content

chore: reliable offline coverage reporting in local-ci - #89

Merged
mcpolo99 merged 2 commits into
developfrom
chore/local-ci-coverage-reporting
Jul 4, 2026
Merged

chore: reliable offline coverage reporting in local-ci#89
mcpolo99 merged 2 commits into
developfrom
chore/local-ci-coverage-reporting

Conversation

@mcpolo99

@mcpolo99 mcpolo99 commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Why

GitHub Actions minutes are a limited budget, and the full build + test + coverage matrix (test.yml) is the most expensive workflow we run. Reserving it for every push/iteration burns through minutes fast. local-ci.sh already reproduces the build and tests offline — this PR makes its coverage reporting a first-class, reliable equivalent of what CI produces, so we can iterate locally and only spend Actions minutes when it actually matters.

What changed (scripts/local-ci.sh only)

1. reportgenerator is now required, not optional
Previously the coverage step silently no-op'd if reportgenerator wasn't installed. Now it installs the dotnet-reportgenerator-globaltool on demand (mirroring test.yml) and puts the dotnet global-tools dir on PATH, so a local run always produces a coverage report.

2. Same report artifacts as CI
Report types bumped from TextSummary only → HtmlInline;Cobertura;TextSummary;MarkdownSummaryGithub — matching test.yml. A local run now emits:

Artifact Path
GitHub markdown summary (the CI PR-comment body) coverage/report/SummaryGithub.md
Browsable HTML report coverage/report/index.html
Cobertura XML coverage/report/Cobertura.xml
Text summary (printed to console) coverage/report/Summary.txt

3. Opt-in: post the summary to a PR as a single sticky comment
So the reliable local coverage can be shared on a PR without spending Actions minutes:

POST_COVERAGE_PR=88 ./scripts/local-ci.sh test
  • Gated entirely behind POST_COVERAGE_PRnever runs unless you set it.
  • Uses the gh CLI. Finds a prior comment by a hidden marker (<!-- local-ci-coverage -->) and edits it instead of adding a new one, so repeated runs update one sticky comment — same UX as CI's sticky-pull-request-comment.
  • All posting failures (gh missing, not authenticated, network) are warnings only — posting can never fail the pipeline.

Notes

Test

  • bash -n scripts/local-ci.sh — clean.
  • Verified reportgenerator ... -reporttypes:HtmlInline;Cobertura;TextSummary;MarkdownSummaryGithub against real cobertura output → produced SummaryGithub.md (27.3% line / 23.8% branch, 5 assemblies) + HTML + Cobertura.

RandomCrocodile added 2 commits July 4, 2026 12:33
…al-ci

The offline CI now installs the reportgenerator global tool on demand (mirroring
.github/workflows/test.yml) instead of silently skipping the coverage report
when it is absent. It also emits the same report types as CI — HTML, Cobertura,
TextSummary and MarkdownSummaryGithub — so a local run produces SummaryGithub.md,
the offline equivalent of the coverage summary CI posts to the PR.
Since GitHub Actions minutes are limited, local-ci now produces the same coverage
markdown as CI (SummaryGithub.md) and can optionally post it to a PR as a single
sticky comment via the gh CLI, gated behind POST_COVERAGE_PR=<num>. It edits a
prior marked comment instead of spamming, mirroring the CI sticky comment.
Posting is opt-in and never runs unless the variable is set; all posting failures
are warnings that never fail the pipeline.
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

Lint Results

All checks passed

Check Result
Whitespace (indentation, line endings)
Style (IDE rules, naming, var usage)
Analyzers (CA*, RCS* rules)

@mcpolo99
mcpolo99 merged commit bd673d6 into develop Jul 4, 2026
2 checks passed
@mcpolo99
mcpolo99 deleted the chore/local-ci-coverage-reporting branch July 4, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant